<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
	
	
	<h:form id="busFaultForm">
		<div id="headDiv" class="box box-solid with-border">
			<div class="box-header" id="queryDiv">
				<p:outputLabel value="结束时间：" />
				<p:calendar navigator="true" maxdate="Date()"
					value="#{deviceFaultCountController.busStartTime}"
					pattern="yyyy-MM-dd"  size="14"/>
				<p:outputLabel value="至"
					style="margin-right:5px;margin-left:5px;" />
				<p:calendar navigator="true" size="14"
					value="#{deviceFaultCountController.busEndTime}"
					pattern="yyyy-MM-dd" maxdate="Date()" />
				<p:commandButton icon="ui-icon-search" value="查询"
					update="busDetailTb"
					actionListener="#{deviceFaultCountController.initBusData}"
					oncomplete="initDataTable();"
					style="margin-left:5px;" />
				<!-- <p:commandButton value="详细"
					actionListener="#{deviceFaultCountController.showBusDetail()}"
					oncomplete="initDataTable();"
					update="busDetailTb" icon="ui-icon-calculator" /> -->
			</div>
		</div>
		
		<p:dataTable id="busDetailTb" var="bus"  scrollWidth="100%"
			value="#{deviceFaultCountController.busbarFaultUploadInfoDtos}"
			emptyMessage="无记录" style="text-align:center"
			rows="10" paginator="true" paginatorPosition="bottom"
			paginatorTemplate="{Customer} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
			rowsPerPageTemplate="20,30,50" rowKey="#{bus.id}"  scrollable="true">
			<f:facet name="{Customer}">
				<p:outputLabel value="总计：#{deviceFaultCountController.busbarFaultUploadInfoDtos.size()}条纪录"
					style="margin-right:20px" />
			</f:facet>
			<p:columnGroup type="header">
				<p:row>
					<p:column width="8%" rowspan="2" headerText="故障时间" />
					<p:column width="8%" rowspan="2" headerText="故障情况" />
					<p:column width="8%" rowspan="2" headerText="厂站" />
					<p:column width="6%" rowspan="2" headerText="集中录波" />
					<p:column width="15%" colspan="3" headerText="主保护" />
					<p:column width="35%" colspan="3" headerText="断路器保护" />
					 <p:column  rowspan="2" headerText="综合上报完好率"  style="width:50px;heigth:50px;"/>
					<p:column  rowspan="2" headerText="保护事件完好率"  style="width:50px;heigth:50px;"/>
					<p:column  rowspan="2" headerText="保护录波完好率"  style="width:50px;heigth:50px;"/>
					<p:column  rowspan="2" headerText="集中录波完好率"  style="width:50px;heigth:50px;"/>
				</p:row>
				<p:row>
					<p:column headerText="名称" />
					<p:column headerText="录波" />
					<p:column headerText="报文" />
					
					<p:column headerText="名称" />
					<p:column headerText="录波" />
					<p:column headerText="报文" />
				</p:row>
			</p:columnGroup>
			 
			<p:column style="height:80px">
				<p:outputLabel>#{deviceFaultCountController.formatterDate(bus.faultTime)}</p:outputLabel>
			</p:column>
			<p:column>
				<p:outputLabel id="faultDeviceLabel">#{bus.faultDesc}</p:outputLabel>
			</p:column>
			<p:column>
				<ui:repeat var="s" value="#{bus.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;" value="#{s.stationName}" />
				</ui:repeat>
			</p:column>
			<p:column>
				<ui:repeat var="s" value="#{bus.stationInfo}">
					<p:outputLabel style="width:100%;height:50%;"
						styleClass="#{s.waveInfo!=-1 ? 'autoUpload':'failedUpload'}">#{deviceFaultCountController.getCentralizedStr(s.waveInfo)}</p:outputLabel>
				</ui:repeat>
			</p:column>
			<p:column>
				<ui:repeat var="s" value="#{bus.stationInfo}">
					<ui:repeat var="mpl" value="#{s.mainProtectList}">
						<p:outputLabel title="#{mpl.name}"
							style="white-space:pre;overflow:hidden;text-overflow:ellipsis">#{mpl.name}</p:outputLabel>
					</ui:repeat>
				</ui:repeat>
			</p:column>
			<p:column>
				<ui:repeat var="s" value="#{bus.stationInfo}">
					<ui:repeat var="mpl" value="#{s.mainProtectList}">
						<p:outputLabel style="width:100%;height:50%;" styleClass="#{mpl.waveInfo!=-1 ? 'autoUpload':'failedUpload'}">
							#{deviceFaultCountController.getCentralizedStr(mpl.waveInfo)}</p:outputLabel>
					</ui:repeat>
				</ui:repeat>
			</p:column>
			<p:column>
				<ui:repeat var="s" value="#{bus.stationInfo}">
					<ui:repeat var="mpl" value="#{s.mainProtectList}">
						<p:outputLabel style="width:100%;height:50%;" styleClass="#{mpl.datagramInfo!=-1 ? 'autoUpload':'failedUpload'}">
							#{deviceFaultCountController.getCentralizedStr(mpl.datagramInfo)}</p:outputLabel>
					</ui:repeat>
				</ui:repeat>
			</p:column>
			<p:column>
				<ui:repeat var="s" value="#{bus.stationInfo}">
					<ui:repeat var="bpl" value="#{s.breakerProtectList}">
						<p:outputLabel title="#{bpl.name}"
							style="white-space:pre;overflow:hidden;text-overflow:ellipsis">#{bpl.name}</p:outputLabel>
					</ui:repeat>
				</ui:repeat>
			</p:column>
			<p:column>
				<ui:repeat var="s" value="#{bus.stationInfo}">
					<ui:repeat var="bpl" value="#{s.breakerProtectList}">
						<p:outputLabel style="width:100%;height:50%;" styleClass="#{bpl.waveInfo!=-1 ? 'autoUpload':'failedUpload'}">
							#{deviceFaultCountController.getCentralizedStr(bpl.waveInfo)}</p:outputLabel>
					</ui:repeat>
				</ui:repeat>
			</p:column>
			<p:column>
				<ui:repeat var="s" value="#{bus.stationInfo}">
					<ui:repeat var="bpl" value="#{s.breakerProtectList}">
						<p:outputLabel style="width:100%;height:50%;" styleClass="#{bpl.datagramInfo!=-1 ? 'autoUpload':'failedUpload'}">
							#{deviceFaultCountController.getCentralizedStr(bpl.datagramInfo)}</p:outputLabel>
					</ui:repeat>
				</ui:repeat>
			</p:column>
			<p:column  >
				<p:outputLabel id="faultDeviceLabel0"  value="#{bus.totalIntactRate}%"  />
			</p:column>
			<p:column  >
				<p:outputLabel id="faultDeviceLabel2"  value="#{bus.protectEventIntactRate}%" />
			</p:column>
			<p:column  >
				<p:outputLabel id="faultDeviceLabel3"  value="#{bus.protectWaveIntactRate}%"/>
			</p:column>
			<p:column  >
				<p:outputLabel id="faultDeviceLabel4" value="#{bus.centralWave}%"/>
			</p:column>
		</p:dataTable>
	</h:form>
</ui:composition>
